package com.spirit.mypopup.pop;

import android.app.Activity;

import android.content.Context;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.Toast;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentTransaction;

import com.spirit.mypopup.R;
import com.spirit.mypopup.popup.QMUIDisplayHelper;

/**
 * author : fang.zhang
 * e-mail : initzf@126.com
 * date   : 2020/5/14
 * desc   :
 */
public class PopWindowWidget2 extends PopupWindow {
    private static final String TAG = "PopWindowWidget2";
    private Context mContext;

    private final int vWidth;
    private final int vHeight;

    private ListView lvPopWindowList;

    private String[] countryGridCode = {"Test A", "Test B", "Test C", "Test D", "Test E", "Test F", "Test G", "Test H", "Test I"};


    public PopWindowWidget2(Context mContext) {
        this.mContext = mContext;

        View view = LayoutInflater.from(mContext).inflate(R.layout.pop_layout, null);

        setContentView(view);


        vWidth = QMUIDisplayHelper.getScreenWidth(mContext);
        vHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 300f, mContext.getResources().getDisplayMetrics());


        setWidth(vWidth);
        setHeight(vHeight);

        setOutsideTouchable(false);
        setFocusable(true);
    }

    public void setView() {
    }


    public PopWindowWidget2 showPopWindow(View view) {
        Log.i(TAG, "showPopWindow: ");
        ///showAsDropDown(view, view.getWidth(), 0);
        return this;
    }
}
